perm filename HALFTO.MF[UHF,DEK] blob sn#830806 filedate 1987-01-28 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	% halftone font with 33 levels of gray, characters "0" (white) to "P" (black)
C00004 ENDMK
CāŠ—;
% halftone font with 33 levels of gray, characters "0" (white) to "P" (black)

pair p[]; % the pixels in order (first p0 becomes black, then p1, etc)
p0=(1,1);
p4=(2,0);
p8=(1,0);
p12=(0,0);
p16=(3,-1);
p20=(2,-1);
p24=(1,-1);
p28=(2,-2);
transform r; r=identity rotatedaround ((1.5,1.5),90);

for i=0 step 4 until 28:
 p[i+1]=p[i] transformed r;
 p[i+3]=p[i+1] transformed r;
 p[i+2]=p[i+3] transformed r;
 endfor

mode_setup;
designsize:=64/pt; % that's 64 pixels

def makebox(text t)= enddef; % shut off boxes

picture prevchar;

prevchar=nullpicture;
for i=0 upto 32:
 beginchar(i+ASCII"0",designsize/8,designsize/16,0);
 currentpicture:=prevchar;
 if i>0: fill unitsquare shifted p[i-1]; fi
 prevchar:=currentpicture;
 endchar;
 endfor

font_quad=designsize/8;
end